package com.scf.fruit.business.order.bo;

import com.github.pagehelper.PageHelper;
import com.scf.fruit.order.OrderDetailInfoDto;
import com.scf.fruit.order.OrderInfoDto;
import com.scf.fruit.order.OrderInfoService;
import com.scf.fruit.util.ResponseVo;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author : 孙超飞
 * @title :
 * @description :
 * @copyright :
 * @date : 2018-05-21 17:53
 */
@Component
public class OrderBo {
    @Resource
    private OrderInfoService orderInfoService;

    public ResponseVo queryOrderByPage(Integer pageNum,Integer length){
        ResponseVo res=new ResponseVo();
        PageHelper.startPage(pageNum,length,false);
        List<OrderInfoDto> orderInfoDtos = orderInfoService.queryOrder();
        res.setData(orderInfoDtos);
        return res;
    }

    public ResponseVo queryOrderDetail(Long orderId){
        ResponseVo res=new ResponseVo();
        List<OrderDetailInfoDto> orderDetailInfoDtos = orderInfoService.queryOrderDetailInfo(orderId);
        res.setData(orderDetailInfoDtos);
        return res;
    }
}
